/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package com.xiashitech.agent.instrumentation.netty.netty_v4_common.client;

//import com.google.auto.value.AutoValue;

import io.netty.channel.Channel;

import javax.annotation.Nullable;
import java.net.SocketAddress;

//@AutoValue
public abstract class NettySslRequest {

  public NettySslRequest(Channel channel, SocketAddress socketAddress) {
  }

  static NettySslRequest create(Channel channel) {
    return new NettySslRequest(channel, channel.remoteAddress()) {
      @Override
      Channel channel() {
        return channel;
      }

      @org.jetbrains.annotations.Nullable
      @Override
      SocketAddress remoteAddress() {
        return channel.remoteAddress();
      }
    };
  }

  String spanName() {
    return "SSL handshake";
  }

  abstract Channel channel();

  @Nullable
  abstract SocketAddress remoteAddress();
}
